package com.zyx.restaurant.server.config;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * @author Yaxi.Zhang
 * @since 2022/10/22 18:48
 */
@Configuration
public class ChannelConfig {
    @Bean
    public Channel rabbitChannel() throws IOException, TimeoutException {
        ConnectionFactory connectionFactory = new ConnectionFactory();
        connectionFactory.setHost("81.68.117.201");
        Connection connection = connectionFactory.newConnection();
        return connection.createChannel();
    }
}
